<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<div th:replace="pages/admin/commons/header :: header"></div>
<body style="background-color:#fff">
<div class="wap-container">
    <div class="panel">
        <div class="panel-body">
            <form action="/childhealth/personnelCode/data-upd" method="post" class="form form-horizontal"
                  id="form-member-add">
                <div class="row clearfix">
                    <br>
                    <input type="hidden" th:value="${type} == toUpd ? 'upd' : 'add'" name="type">

                    <input type="hidden" class="input-text" th:if="${result} != null"
                           th:value="${result.id}" name="id">

                    <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>代码：</label>
                    <div class="form-controls col-xs-8 col-sm-9">

                        <input type="text" class="input-text" th:if="${result} != null" name="personnelCoding"
                               th:value="${result.personnelCoding}"
                               placeholder="编码">
                        <input type="text" class="input-text" th:if="${result} == null" placeholder="编码"
                               name="personnelCoding">
                    </div>
                    <br><br><br>

                    <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>姓名：</label>
                    <div class="form-controls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" th:if="${result} != null"
                               th:value="${result.name}"
                               placeholder="姓名"
                               name="name">
                        <input required lay-verify="required" type="text" class="input-text" th:if="${result} == null"
                               placeholder="姓名"
                               name="name">
                    </div>
                    <br><br><br>

                    <label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>拼音编码：</label>
                    <div class="form-controls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" th:if="${result} != null"
                               th:value="${result.pinyinCoding}"
                               placeholder="拼音编码"
                               name="pinyinCoding">
                        <input type="text" class="input-text" th:if="${result} == null" placeholder="拼音编码"
                               name="pinyinCoding">
                    </div>
                    <br><br><br>

                    <label class="form-label col-xs-4 col-sm-3">性别：</label>
                    <div class="form-controls col-xs-8 col-sm-9">
                        <span class="select-box" style="width:150px;">
							<select id="sel1" class="select" name="gender">
								<option value="男">男</option>
								<option value="女">女</option>
							</select>
                        </span>
                    </div>
                    <br><br><br>

                    <label class="form-label col-xs-4 col-sm-3">类别：</label>
                    <div class="form-controls col-xs-8 col-sm-9">
                        <span class="select-box" style="width:150px;">
							<select id="sel2" class="select" name="category">
								<option value="医护人员">医护人员</option>
								<option value="行政人员">行政人员</option>
								<option value="公务员">公务员</option>
							</select>
                        </span>
                    </div>
                    <br><br><br>
                    <label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>出生日期：</label>
                    <div class="form-controls col-xs-8 col-sm-9">
                        <input id="test2" type="text" class="input-text" th:if="${result} != null"
                               th:value="${#dates.format(result.birthDate,'yyyy-MM-dd HH:mm:ss')}"
                               placeholder="出生日期"
                               name="birthDate">
                        <input id="test1" type="text" class="input-text" th:if="${result} == null" placeholder="出生日期"
                               name="birthDate">
                    </div>
                    <br><br><br>

                    <label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>年龄：</label>
                    <div class="form-controls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" th:if="${result} != null"
                               th:value="${result.age}"
                               placeholder="年龄"
                               name="age">
                        <input type="text" class="input-text" th:if="${result} == null" placeholder="年龄"
                               name="age">
                    </div>
                    <br><br><br>


                    <label class="form-label col-xs-4 col-sm-3">学历：</label>
                    <div class="form-controls col-xs-8 col-sm-9">
                        <span class="select-box" style="width:150px;">
							<select id="sel3" class="select" name="education">
								<option value="博士">博士</option>
								<option value="硕士">硕士</option>
								<option value="本科">本科</option>
								<option value="大专">大专</option>
								<option value="高中或中专">高中或中专</option>
								<option value="初中">初中</option>
								<option value="小学">小学</option>
								<option value="文盲">文盲</option>
							</select>
                        </span>
                    </div>
                    <br><br><br>

                    <label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>身份证号码：</label>
                    <div class="form-controls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" th:if="${result} != null"
                               th:value="${result.idCard}"
                               placeholder="身份证号码"
                               name="idCard">
                        <input type="text" class="input-text" th:if="${result} == null" placeholder="身份证号码"
                               name="idCard">
                    </div>
                    <br><br><br>

                    <label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>联系QQ：</label>
                    <div class="form-controls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" th:if="${result} != null"
                               th:value="${result.contactQq}"
                               placeholder="联系QQ"
                               name="contactQq">
                        <input type="text" class="input-text" th:if="${result} == null" placeholder="联系QQ"
                               name="contactQq">
                    </div>
                    <br><br><br>

                    <label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>联系电话：</label>
                    <div class="form-controls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" th:if="${result} != null"
                               th:value="${result.contactPhone}"
                               placeholder="联系电话"
                               name="contactPhone">
                        <input type="text" class="input-text" th:if="${result} == null" placeholder="联系电话"
                               name="contactPhone">
                    </div>
                    <br><br><br>

                    <label class="form-label col-xs-4 col-sm-3">职称：</label>
                    <div class="form-controls col-xs-8 col-sm-9">
                        <span class="select-box" style="width:150px;">
							<select id="sel4" class="select" name="zhicheng">
								<option value="高级统计师">高级统计师</option>
								<option value="统计师">统计师</option>
								<option value="助理统计师">助理统计师</option>
								<option value="统计员">统计员</option>
								<option value="主任医师">主任医师</option>
								<option value="副主任医师">副主任医师</option>
								<option value="主治医师">主治医师</option>
								<option value="医师">医师</option>
								<option value="医士">医士</option>
								<option value="主任护师">主任护师</option>
								<option value="副主任护师">副主任护师</option>
								<option value="主管护师">主管护师</option>
								<option value="护师">护师</option>
								<option value="研究员">研究员</option>
								<option value="副研究员">副研究员</option>
								<option value="助理研究员">助理研究员</option>
								<option value="研究实习员">研究实习员</option>
							</select>
                        </span>
                    </div>
                    <br><br><br>

                    <label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>职务：</label>
                    <div class="form-controls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" th:if="${result} != null"
                               th:value="${result.zhiwu}"
                               placeholder="职务"
                               name="zhiwu">
                        <input type="text" class="input-text" th:if="${result} == null" placeholder="职务"
                               name="zhiwu">
                    </div>
                    <br><br><br>

                    <label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>电子邮箱：</label>
                    <div class="form-controls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" th:if="${result} != null"
                               th:value="${result.email}"
                               placeholder="电子邮箱"
                               name="email">
                        <input type="text" class="input-text" th:if="${result} == null" placeholder="电子邮箱"
                               name="email">
                    </div>
                    <br><br><br>

                    <label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>家庭住址：</label>
                    <div class="form-controls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" th:if="${result} != null"
                               th:value="${result.addr}"
                               placeholder="家庭住址"
                               name="addr">
                        <input type="text" class="input-text" th:if="${result} == null" placeholder="家庭住址"
                               name="addr">
                    </div>
                    <br><br><br>

                    <label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>备注：</label>
                    <div class="form-controls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" th:if="${result} != null"
                               th:value="${result.remark}"
                               placeholder="备注"
                               name="remark">
                        <input type="text" class="input-text" th:if="${result} == null" placeholder="备注"
                               name="remark">
                    </div>
                    <br><br><br>

                    <label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>业务范围：</label>
                    <div class="form-controls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" th:if="${result} != null"
                               th:value="${result.businessScope}"
                               placeholder="业务范围"
                               name="businessScope">
                        <input type="text" class="input-text" th:if="${result} == null" placeholder="业务范围"
                               name="businessScope">
                    </div>
                    <br><br><br>

                </div>
                <div class="row clearfix">
                    <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                        <button style=" margin-left: inherit" class="btn btn-primary radius" type="submit">
                            [[${type}=='toUpd'? '修改':'添加']]
                        </button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<input type="hidden" id="t1" th:if="${result} != null" th:value="${result.gender}">
<input type="hidden" id="t2" th:if="${result} != null" th:value="${result.category}">
<input type="hidden" id="t3" th:if="${result} != null" th:value="${result.education}">
<input type="hidden" id="t4" th:if="${result} != null" th:value="${result.zhicheng}">
<div th:replace="pages/admin/commons/footer :: footer"></div>
<script th:src="@{/layui/layui.js}" charset="utf-8"></script>
<script type="text/javascript">

    //选中当前性别
    $("#sel1").find("option").each(function () {
        if ($(this).text() == $("#t1").val()) {
            $(this).attr("selected", true);
        }
    });

    $("#sel2").find("option").each(function () {
        if ($(this).text() == $("#t2").val()) {
            $(this).attr("selected", true);
        }
    });

    $("#sel3").find("option").each(function () {
        if ($(this).text() == $("#t3").val()) {
            $(this).attr("selected", true);
        }
    });
    $("#sel4").find("option").each(function () {
        if ($(this).text() == $("#t4").val()) {
            $(this).attr("selected", true);
        }
    });

    layui.use('laydate', function () {
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#test1', //指定元素
            type: 'datetime'
        });
        laydate.render({
            elem: '#test2', //指定元素
            type: 'datetime'
        });
    });

</script>
</body>
</html>
